/*
 * diagnosis.cpp
 *
 *  Created on: Jul 2, 2011
 *      Author: nzhao
 */
#include "share/diagnosis.h"

void diagnosis(char * filename, double * data, int dim1, int dim2)
{
	int i, j;
	char dbg_file[200];
	strcpy(dbg_file, WORKSHOP);
	strcat(dbg_file, DEBUG_PATH);
	strcat(dbg_file, filename);
	ofstream dbg(dbg_file);

	dbg << setw(12) << setiosflags(ios::scientific) << setprecision(12);
	for(i = 0; i < dim1; i ++)
	{
		for(j = 0; j < dim2; j ++)
		{
			dbg << data[i * dim2 + j] << "\t";
		}
		dbg << endl;
	}

	dbg.close();

}

void diagnosis_CLD(char * filename, CLD * data, int dim1, int dim2)
{
	int i, j;
	char dbg_file[200];
	strcpy(dbg_file, WORKSHOP);
	strcat(dbg_file, DEBUG_PATH);
	strcat(dbg_file, filename);
	ofstream dbg(dbg_file);

	dbg << setw(12) << setiosflags(ios::scientific) << setprecision(12);
	for(i = 0; i < dim1; i ++)
	{
		for(j = 0; j < dim2; j ++)
		{
			dbg << data[i * dim2 + j] << "\t";
		}
		dbg << endl;
	}

	dbg.close();

}
